package com.haopt.clock.controller;

import com.haopt.clock.dto.ResultDTO;
import com.haopt.clock.service.ClockInService;
import com.haopt.clock.vo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author haopt
 * @version 1.0
 * @ClassName ClockInController
 * @Description TODO
 * @date 2021/3/19 14:35
 */
@RestController
@RequestMapping("/clockIn")
public class ClockInController {

    @Autowired
    private ClockInService clockInService;

    /**
     * 打卡
     * @param reqVo
     * @return
     */
    @PostMapping("/add")
    public ResultDTO<ResIdVO> add(@RequestBody ReqClockInAddVO reqVo) {
        return clockInService.add(reqVo);
    }

    /**
     * 获取最近几天打卡记录
     * @param reqVo
     * @return
     */
    @PostMapping("/list")
    public ResultDTO<List<ResClockInListVO>> list(@RequestBody ReqClockInListVO reqVo) {
        return clockInService.list(reqVo);
    }

    /**
     * 分页获取今天的打卡记录
     * @param vo
     * @return
     */
    @PostMapping("/listOfPage")
    public ResultDTO<ResPageVO<ResClockInListVO>> listOfPage(@RequestBody ReqPageVO vo) {
        return clockInService.listOfPage(vo);
    }
}
